package com.module.guide.utils;


import android.content.Context;
import android.content.SharedPreferences;

import com.module.guide.R;

import java.security.Key;

public class CfgUtils {
    private static SharedPreferences spInsert;
    private static  SharedPreferences spFind;
    public static void insertByKey(String key, String value,Context context){
        spInsert=context.getSharedPreferences(context.getResources().getString(R.string.spName),Context.MODE_PRIVATE);

        SharedPreferences.Editor editor=spInsert.edit();
        editor.putString(key,value);
        editor.commit();
    } public static void insertByKey(String key, Boolean value,Context context){
        spInsert=context.getSharedPreferences(context.getResources().getString(R.string.spName),Context.MODE_PRIVATE);

        SharedPreferences.Editor editor=spInsert.edit();

        editor.putBoolean(key,value);
        editor.commit();
    }
    public static String findByKeyStr(String key,Context context){
        spFind=context.getSharedPreferences(context.getResources().getString(R.string.spName),Context.MODE_PRIVATE);

        return  spFind.getString(key,null);
    }
    public static boolean findByKeyBool(String key,boolean def,Context context){
        spFind=context.getSharedPreferences(context.getResources().getString(R.string.spName),Context.MODE_PRIVATE);

        return  spFind.getBoolean(key,def);
    }
}
